To use the SFPack Library in your Visual Basic program you must first add a reference to the library. Open the References Dialog and check Megota Software SFPack Library (1.0).
This code sample shows how you can pack a SF2 file to a SFPack File.
Private WithEvents e As Engine Sub CompressFile (cSF2File As String, cSFPackFile As String, _ Set e = new Engine ' Check if everything is OK ' Now set the properties for the SFPack File |
This sample shows how to unpack a SFPack File
Private WithEvents e As Engine Sub InflateFile (cSFPackFile As String, cSF2File As String) Set e = new Engine ' Check if everything is OK ' Display the Text (if any) If .IsEncrypted Then ' Inflate to SF2 File |
With the help of the progress event you can do background processing while the Inflate or Pack method is running. In this example it is assumed that a dialog box is displayed, which has a ProgressBar pb and a Button btCancel. Note also the declaration of e with the WithEvents keyword.
Private WithEvents e As Engine Private Sub btCancel_Click() bCancel = TRUE End Sub Private Sub e_Progress (ByVal nPercent As Integer) ' Update the progress bar display |